import { Column, Entity, ManyToMany, PrimaryGeneratedColumn } from 'typeorm';
import { User } from '@/modules/user/user.entity';
import { Menu } from '@/modules/menu/menu.entity';

@Entity()
export class Roles {
  @PrimaryGeneratedColumn()
  id: number;
  @Column()
  name: string;

  @ManyToMany('User', (user: User) => user.roles)
  users: User[];

  @ManyToMany('Menu', (menu: Menu) => menu.roles)
  menus: Menu[];
}
